import Vue from "vue";
import VueRouter from "vue-router";
import Home from '@/views/Home2.vue';//预加载


Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    // component: ()=>import("../views/Home.vue")//懒加载
    component:Home
  },
  {
    path:"/register",
    component: () => import("../views/Register.vue")//懒加载
  },
  {
  path:"/contact",
    component: () => import("../views/Contact.vue")//懒加载
},
  {
    path: "/home",
    component: () => import("../views/Home.vue"),

    children: [
      {
        path: "user",
        component: () => import("../views/User.vue")//懒加载
      }, {
        path: "goods",
        component: () => import("../views/goods.vue")//懒加载
      },
    ]
  },
  {
    path: "/login",
    component: ()=>import("../views/Login.vue")
  }

];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
